package com.own.business.question.business.service;

import com.own.business.question.entity.bo.QuestionOptionBo;
import com.own.business.question.entity.map.QuestionOptionMapVo;
import com.own.business.question.entity.po.Question;
import com.own.business.question.entity.po.QuestionOption;
import com.own.business.question.entity.query.QuestionOptionQuery;
import com.own.business.question.entity.vo.QuestionOptionVo;
import com.own.component.common.base.service.BaseService;

import java.util.Collections;
import java.util.List;

/**
 * QuestionOptionService
 *
 * @author 陈学礼 （你是一段成熟的代码，要学会自己改bug）
 * @version 4.0.0
 * @date 2021/05/14 09:41:05
 * @since 4.0.0
 */
public interface QuestionOptionService extends BaseService<
        QuestionOption,
        QuestionOptionBo,
        QuestionOptionVo,
        QuestionOptionMapVo,
        QuestionOptionQuery
        > {

    /**
     * 添加选项信息
     *
     * @param questionId         题目id
     * @param questionType       题目类型
     * @param questionOptionList 选项列表
     * @return 添加完后的列表
     */
    default List<QuestionOption> addPoBatch(Long questionId, Integer questionType, List<QuestionOptionBo> questionOptionList) {
        if (Question.Type.SINGLE_CHOICE == questionType || Question.Type.MULTIPLE_CHOICE == questionType) {
            return addPoBatch(questionId, questionOptionList);
        }
        return Collections.emptyList();
    }

    /**
     * 添加选项信息
     *
     * @param questionId         题目id
     * @param questionOptionList 选项列表
     * @return 添加完后的列表
     */
    List<QuestionOption> addPoBatch(Long questionId, List<QuestionOptionBo> questionOptionList);

}
